
package com.epam.android.training.level1.widget;

import com.epam.android.training.level1.UniqueEntity;

import android.widget.BaseAdapter;

import java.util.List;

/**
 * @author Anton Novikau
 */
public abstract class CollectionAdapter<T extends UniqueEntity> extends BaseAdapter {

  private final List<T> items;

  public CollectionAdapter(List<T> items) {
    this.items = items;
  }

  @Override
  public int getCount() {
    return items.size();
  }

  @Override
  public T getItem(int position) {
    return items.get(position);
  }

  @Override
  public long getItemId(int position) {
    return getItem(position).getId();
  }
}
